package cn.yuyin.item;
import java.io.IOException;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import cn.yuyin.main.Main;

public class Find_friends_item extends Item {
	

	private Image head;

	public Find_friends_item(int index,int x, int y, String text) {
		super(x, y, text);
		this.index = index;
		try {
			head = Image.createImage("/t1.png");
		} catch (IOException e) {
			e.printStackTrace();
		}
		width = Main.font.stringWidth(text)+head.getWidth()+Main.rowspace ;
		height = Main.font.getHeight();
		if(height<25){
			height = 25;
		}
		
		endX = x + width;
		endY = y + height;
	}
	
	public void paint(Graphics g) {
		if(index == Main.superPage.index){
			ishaveFouse = true;
		}else {
			ishaveFouse = false;
		}
	
		int tempX = x;
		int tempW = width;	
	
		if(ishaveFouse){
			g.setColor(0xcecbce);
			g.drawRect(tempX-1, y-1, tempW+1, height+1);
			g.setColor(0);
			g.drawImage(head, x, y, 0);
			g.drawString(text, x+head.getWidth()+Main.margin, y-2, 0);
		}else{
			g.setColor(0);
			g.drawImage(head, x, y, 0);
			g.drawString(text, x+head.getWidth()+Main.margin, y-2, 0);
		}
	
	}

	public void keyReleased(int keyCode) {
		switch (keyCode) {
		case Main.key_LEFT:
			break;
		case Main.key_RIGHT:
			break;
		case Main.key_DOWN:
			
			break;
		case Main.key_UP:
			
			break;
		}
	}

	public void pointerPressed(int x, int y) {
		
	}

	public void pointerReleased(int x, int y) {
		
	}

}
